package com.ruoyi.web.controller.openapi;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.dto.ProgressDto;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.Customers;
import com.ruoyi.system.domain.Platforms;
import com.ruoyi.system.service.ICustomersService;
import com.ruoyi.system.service.IPlatformsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 平台Controller
 * 
 * @author zzbird
 * @date 2023-11-14
 */
@Api("平台管理")
@RestController
@RequestMapping("/openapi")
public class OpenApiController extends BaseController
{
    @Autowired
    private ICustomersService customersService;

    /**
     * 根据手机号获取平台信息
     */
    @ApiOperation("OpenApi接口-根据手机号获取平台信息")
    @GetMapping("/getCustomerInfo")
    public AjaxResult getCustomerInfo(String phoneNumber)
    {
        ProgressDto progressDto = new ProgressDto();
        progressDto.setCustomerPhone(phoneNumber);
        List<Customers> results = customersService.getCustomerPlatformsAndProgress(progressDto);
        //屏蔽真实进度
        results.forEach(customers -> customers.setCurrentProgress(null));
        return success(results);
    }
}
